﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace JAMR.Utils
{
    public static class GraphicExtensions
    {
        public static Bitmap GetRectangle(this Bitmap b, int x, int y, int width, int height)
        {
            Bitmap p = new Bitmap(width, height);

            for (int xi = 0; xi < width; xi++)
                for (int yi = 0; yi < height; yi++)
                    p.SetPixel(xi, yi, b.GetPixel(x + xi, y + yi));

            return p;
        }
    }
}
